package com.jbit.pages;

import com.github.pagehelper.PageInfo;

import java.util.List;

public class Page<T> {
    private Integer currentPage;
    private Integer pageCount;
    private Integer pageSize;
    private Long total;
    private List<T> rows;

    public static Page getPage(PageInfo pageInfo) {
        Page page = new Page();
        page.setTotal(pageInfo.getTotal());
        page.setCurrentPage(pageInfo.getPageNum());
        page.setPageCount(pageInfo.getPages());
        page.setPageSize(pageInfo.getPageSize());
        page.setRows(pageInfo.getList());
        return page;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
